<template>
	<view :class="['page',{'iphoneX':isIphoneX}]">  
		<view   class="body"> 
			<view class="goods-wrap m-b2">
				<view class="item">
					<text class="label">{{detail.pname}}</text>
					<text>{{detail.p_count}}{{detail.min_uname.uname}}</text>
				</view>
				<view class="item">
					<text class="label">入库总数</text>
					<text>{{detail.in_count}}{{detail.min_uname.uname}}</text>
				</view>
				<view class="item">
					<text class="label">出库总数</text>
					<text>{{detail.out_count}}{{detail.min_uname.uname}}</text>
				</view>
				<!-- <u--form ref="uForm" class="form-wrap">
					<u-form-item label="产品名称" labelWidth="160" prop="categoryname" borderBottom="true" class="u-form-item">
						<u-input v-model="detail.pname" disabled disabledColor="#ffffff" border="none" /> 	
						<u--text v-if="detail.min_uname.uname" class="text-unit" :text="detail.min_uname.uname" size="30" align="right" ></u--text>
					</u-form-item>
					<u-form-item label="入库总数" labelWidth="160" prop="productname" borderBottom="true" class="u-form-item">
						<u-input v-model="detail.in_count" disabled disabledColor="#ffffff" border="none" /> 
						<u--text v-if="detail.min_uname.uname" class="text-unit" :text="detail.min_uname.uname" size="30" align="right" ></u--text>
					</u-form-item>  
					<u-form-item label="出库总数" labelWidth="160" prop="productname" borderBottom="true" class="u-form-item">
						<u-input v-model="detail.out_count" disabled disabledColor="#ffffff" border="none" />
						<u--text v-if="detail.min_uname.uname" class="text-unit" :text="detail.min_uname.uname" size="30" align="right" ></u--text>
					</u-form-item> 
				</u--form> -->
			</view>
			<view v-if="list.length>0" class="sp-list-wrap"> 
				<view class="item" v-for="(item,index) in list" :key="index" @click="read(index)">
					<view class="type">  
						<text v-if="item.apply_type == 1 || item.apply_type == 4 || item.apply_type == 5"> 入库 </text>
						<text v-if="item.apply_type == 2"> 出库 </text>
						<text v-if="item.apply_type == 6"> 仓库 </text>
					</view>
					<view class="info">
						<view class="content split-line">{{item.username}} {{item.p_count}}{{item.uname}}</view>
						<view class="time">{{item.last_update_time}}</view>
					</view>
					<text class="f-s30 f-red" v-if="item.apply_type == 1 || item.apply_type==4 || item.apply_type==5">+{{item.pre_num}}{{item.min_uname}}</text>
					<text class="f-s30 f-red" v-if="item.apply_type == 6 && (item.apply_status==2 || item.apply_status==4 ) && item.send_storehouseman==storehouseman">-{{item.pre_num}}{{item.min_uname}}</text>
					<text class="f-s30 f-red" v-if="item.apply_type == 6 && (item.apply_status==6) && item.send_storehouseman==storehouseman">+{{item.pre_num}}{{item.min_uname}}</text>
					<text class="f-s30 f-red" v-if="item.apply_type == 2">-{{item.pre_num}}{{item.min_uname}}</text>									 
				</view>
				 
			</view>	
			 
		</view> 
		 
	</view>
</template>

<script>
	import {IMG_PATH} from '../../config.js'
	export default {
		data() {
			return {
				isLogin:false, 
				isIphoneX:getApp().globalData.isIphoneX,
				pid:'',
				storehouseman:'',
				detail:{}, 
				list:[],
				loadingState:{
					default:false,
					loading:false,
					completed:false
				},
				params:{
					page:1,
					limit:15,
					search:'', 
				},
				
			}
		},
		onLoad(params) {  
			console.log(params)
			this.pid=params.pid;
			this.storehouseman=params.storehouseman;
			this.productinfo();
			this.producthistory();
			this.getauth();
		},
		onShow() {
			
		},
		onReachBottom(){
			 
		},
		methods: { 
			
			async productinfo(){ 
				let res=await this.$api.user_api.productinfo({
					p_id:this.pid,
					storehouseman:this.storehouseman
				});   
				console.log({
					p_id:this.pid,
					storehouseman:this.storehouseman
				}) 
				console.log(res)
				if(res.data.code==200){   
					this.detail=res.data.data.plist; 
					console.log(this.detail)
				}
			}, 
			
			async producthistory(){
				let res=await this.$api.user_api.producthistory({
					p_id:this.pid,
					storehouseman:this.storehouseman,
					search:'',
					page:'1',
					limit:'10'
				});   
				console.log({
					p_id:this.pid,
					storehouseman:this.storehouseman
				}) 
				console.log(res)
				if(res.data.code==200){    
					console.log(this.detail)
					this.list=res.data.data.list;
				}
			}, 
			 
			
		},
		computed:{
			 
		},
		watch:{
			 
		}
	}
</script>

<style lang="less">
	.goods-wrap{
		padding: 0 20rpx;
		background: #fff;
		.hd-title{
			padding: 20rpx 0;
		}
		.item{
			display: flex;
			padding: 25rpx 0;
			border-bottom: 1rpx solid #eee;
			font-size: 30rpx;
			.label{
				width: 200rpx;
			}
		}
	}  
	.sp-list-wrap{
		padding:20rpx 0;
		.item{
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding:20rpx;
			margin-bottom: 10rpx;
			background: #fff; 
			border-top: 1rpx solid #e5e5e5;
			border-bottom:1rpx solid #e5e5e5; 
			.type{
				flex-shrink: 0; 
				width: 110rpx;
				height: 90rpx;
				line-height: 90rpx;
				font-size: 30rpx; 
				background: #cbc5c7;
				border-radius: 48rpx;
				text-align: center;
				color:#fff;
			}
			.info{
				flex-grow: 2;
				.content{
					padding:0 20rpx;
					margin-bottom: 20rpx;
					font-size: 28rpx;
					color:#999;
				}
				.time{
					padding:0 15rpx 15rpx; 
					font-size: 28rpx;
					color:#999;
				}
			}
			.status{
				border-radius: 48rpx;
				flex-shrink: 0;
				width: 110rpx;
				height: 90rpx;
				line-height: 90rpx;
				font-size: 30rpx;
				text-align: center;
				background: #f33632;
				color:#fff;
			}			 
		}
	}
</style>
